package com.jeesite.modules.warehouseposition.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 库位档案Entity
 * @author 码脑洞
 * @version 2025-04-08
 */
@Table(name="t_warehouse_position", alias="a", label="库位档案信息", columns={
		@Column(name="auto_id", attrName="autoId", label="主键", isPK=true),
		@Column(name="org_id", attrName="orgId", label="组织ID", isQuery=false),
		@Column(name="org_code", attrName="orgCode", label="组织编码", isQuery=false),
		@Column(name="org_name", attrName="orgName", label="组织名称", isQuery=false),
		@Column(name="code", attrName="code", label="库位编码"),
		@Column(name="name", attrName="name", label="库位名称", queryType=QueryType.LIKE),
		@Column(name="warehouse_id", attrName="warehouseId", label="所属仓库"),
		@Column(name="area_id", attrName="areaId", label="所属库区", isUpdateForce=true),
		@Column(name="shelves_id", attrName="shelvesId", label="所属货架", isUpdateForce=true),
		@Column(name="length", attrName="length", label="长", isQuery=false, isUpdateForce=true),
		@Column(name="width", attrName="width", label="宽", isQuery=false, isUpdateForce=true),
		@Column(name="height", attrName="height", label="高", isQuery=false, isUpdateForce=true),
		@Column(name="max_weight", attrName="maxWeight", label="最大重量", isQuery=false, isUpdateForce=true),
		@Column(name="max_bulk", attrName="maxBulk", label="最大体积", isQuery=false, isUpdateForce=true),
		@Column(name="source_type", attrName="sourceType", label="来源", comment="来源: 1.手工新增 2. ERP", isQuery=false),
		@Column(name="source_code", attrName="sourceCode", label="来源编码", isQuery=false),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class WarehousePosition extends DataEntity<WarehousePosition> {
	
	private static final long serialVersionUID = 1L;
	private Long autoId;		// 主键
	private Long orgId;		// 组织ID
	private String orgCode;		// 组织编码
	private String orgName;		// 组织名称
	private String code;		// 库位编码
	private String name;		// 库位名称
	private Long warehouseId;		// 所属仓库
	private Long areaId;		// 所属库区
	private Long shelvesId;		// 所属货架
	private Double length;		// 长
	private Double width;		// 宽
	private Double height;		// 高
	private Double maxWeight;		// 最大重量
	private Double maxBulk;		// 最大体积
	private String sourceType;		// 来源: 1.手工新增 2. ERP
	private String sourceCode;		// 来源编码

	public WarehousePosition() {
		this(null);
	}
	
	public WarehousePosition(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAutoId() {
		return autoId;
	}

	public void setAutoId(Long autoId) {
		this.autoId = autoId;
	}
	
	@NotNull(message="组织ID不能为空")
	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}
	
	@NotBlank(message="组织编码不能为空")
	@Size(min=0, max=10, message="组织编码长度不能超过 10 个字符")
	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	
	@NotBlank(message="组织名称不能为空")
	@Size(min=0, max=30, message="组织名称长度不能超过 30 个字符")
	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
	
	@NotBlank(message="库位编码不能为空")
	@Size(min=0, max=30, message="库位编码长度不能超过 30 个字符")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	@NotBlank(message="库位名称不能为空")
	@Size(min=0, max=100, message="库位名称长度不能超过 100 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@NotNull(message="所属仓库不能为空")
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getWarehouseId() {
		return warehouseId;
	}

	public void setWarehouseId(Long warehouseId) {
		this.warehouseId = warehouseId;
	}

	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAreaId() {
		return areaId;
	}

	public void setAreaId(Long areaId) {
		this.areaId = areaId;
	}

	@JsonSerialize(using = ToStringSerializer.class)
	public Long getShelvesId() {
		return shelvesId;
	}

	public void setShelvesId(Long shelvesId) {
		this.shelvesId = shelvesId;
	}
	
	public Double getLength() {
		return length;
	}

	public void setLength(Double length) {
		this.length = length;
	}
	
	public Double getWidth() {
		return width;
	}

	public void setWidth(Double width) {
		this.width = width;
	}
	
	public Double getHeight() {
		return height;
	}

	public void setHeight(Double height) {
		this.height = height;
	}
	
	public Double getMaxWeight() {
		return maxWeight;
	}

	public void setMaxWeight(Double maxWeight) {
		this.maxWeight = maxWeight;
	}
	
	public Double getMaxBulk() {
		return maxBulk;
	}

	public void setMaxBulk(Double maxBulk) {
		this.maxBulk = maxBulk;
	}
	
	@Size(min=0, max=1, message="来源长度不能超过 1 个字符")
	public String getSourceType() {
		return sourceType;
	}

	public void setSourceType(String sourceType) {
		this.sourceType = sourceType;
	}
	
	@Size(min=0, max=64, message="来源编码长度不能超过 64 个字符")
	public String getSourceCode() {
		return sourceCode;
	}

	public void setSourceCode(String sourceCode) {
		this.sourceCode = sourceCode;
	}
	
}